package main

import (
	"fmt"
	"strings"
	"unicode"
)

func main(){
	var pasword string
	fmt.Print("请输入密码：")
	fmt.Scan(&pasword)
	fmt.Print(check(pasword))

}

func check(password string) (string){
	if len(password)<8 {
		return "密码字符串长度小于8"
	}
	var hasUpper, hasLower, hasDigit, hasSymbol int
	for _, ch := range password {
		switch {
		case unicode.IsUpper(ch):
			hasUpper = 1
		case unicode.IsLower(ch):
			hasLower = 1
		case unicode.IsDigit(ch):
			hasDigit = 1
		case unicode.IsPunct(ch) || unicode.IsSymbol(ch):
			hasSymbol = 1
		}
	}
	if hasUpper+hasLower+hasDigit+hasSymbol<3 {
		return "密码没有由三种以上字符组成"
	}
	for i := 0; i < len(password)-2; i++{
		x := password[i:i+3]
		if strings.Count(password,x) > 1{
			return "密码包含相同的子字符串"
		}
	}

	return "密码符合要求"
}